package com.liu.friend.dao;

import com.liu.friend.pojo.Friend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Created by Administrator on 2019/8/23 0023.
 */
public interface FriendDao extends JpaRepository<Friend,String> {

    @Query("select count(f) from Friend f where f.userid= ?1 AND f.friendid = ?2")
    public int selectCount(String userid,String friendid);

    @Modifying
    @Query("update Friend f set f.islike=?3 where f.userid=?1 and  f.friendid=?2")
    public void updateLike(String userid,String friendid,String islike);


    @Query("delete  from Friend  f where f.userid=?1 and f.friendid = ?2")
    public void deleteByFriend(String userid,String friendid);

}
